#include <iostream>
#include <string>
int main() {
    std::string s1;
    
    std::string s;
    std::cin >> s;
    
    for (char c : s) {
        if (c=='(') {
            s1 += c;
        }
        
        if ( c==')' ) {
            if (s1.length() > 0) {
                if (s1[ s1.length() - 1] == '(' ) {
                    s1.pop_back();
                }
            }
        }
        if (c=='[') {
            s1 += c;
        }
        
        if ( c==']' ) {
            if (s1.length() > 0) {
                if (s1[ s1.length() - 1] == '[' ) {
                    s1.pop_back();
                }
            }
        }
        if (c=='{') {
            s1 += c;
        }
        
        if ( c=='}' ) {
            if (s1.length() > 0) {
                if (s1[ s1.length() - 1] == '{' ) {
                    s1.pop_back();
                }
            }
        }
        if (c=='<') {
            s1 += c;
        }
        
        if ( c=='>' ) {
            if (s1.length() > 0) {
                if (s1[ s1.length() - 1] == '<' ) {
                    s1.pop_back();
                }
            }
        }
        //std::cout <<s1<<std::endl;
    }
    
    if (s1.length() > 0)
        { std::cout << "False" << std::endl;}
    else
        { std::cout << "True" << std::endl;}
    return 0;
}